home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / mail / mh / contrib / 9209 / emacs.comp < prev    next >
Text File  |  1992-09-20  |  1KB  |  63 lines

  1. #!/bin/ksh
  2. ###############################################################################
  3. # emacs.comp - editor front end for the MH comp command
  4. #
  5. # Gregory F. March (march@nynexst.com)
  6. #
  7. #------------------------------------------------------------------------------
  8. #
  9. # NOTE: This is brute force and not that great of a coding job...
  10. #
  11. ###############################################################################
  12.  
  13. DRAFT=~/Mail/draft
  14.  
  15. touch /tmp/mh-gfm.$$
  16.  
  17. IFS_save=$IFS
  18. IFS=
  19.  
  20. if [ `grep -c "^To:" $DRAFT` -le 0 ]
  21. then
  22.     read ADDRESS?'To:      '
  23.     print "To: $ADDRESS" > /tmp/mh-gfm.$$        # always need a To:
  24. fi
  25.  
  26. if [ `grep -c "^Subject:" $DRAFT` -le 0 ]
  27. then
  28.     read SUBJECT?'Subject: '
  29.     if [ ${SUBJECT:-""} != "" ]
  30.     then
  31.         print "Subject: $SUBJECT" >> /tmp/mh-gfm.$$
  32.     fi
  33. fi
  34.  
  35. if [ `grep -c "^Cc:" $DRAFT` -le 0 ]
  36. then
  37.     read CCFIELD?'Cc:      '
  38.     if [ ${CCFIELD:-""} != "" ]
  39.     then
  40.         print "Cc: $CCFIELD" >> /tmp/mh-gfm.$$
  41.     fi
  42. fi
  43.  
  44. if [ `grep -c "^Bcc:" $DRAFT` -le 0 ]
  45. then
  46.     read BCCFIELD?'Bcc:     '
  47.     if [ ${BCCFIELD:-""} != "" ]
  48.     then
  49.         print "Bcc: $BCCFIELD" >> /tmp/mh-gfm.$$
  50.     fi
  51. fi
  52.  
  53. IFS=$IFS_save
  54.  
  55. cat /tmp/mh-gfm.$$ $DRAFT > /tmp/mh-gfm2.$$
  56. cp /tmp/mh-gfm2.$$ $DRAFT
  57.  
  58. rm -f /tmp/mh-gfm.$$ /tmp/mh-gfm2.$$
  59.  
  60. emacs $DRAFT -f end-of-buffer
  61.  
  62. rm -f $DRAFT*~
  63.